﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Data;
using DataProvider;


namespace SGBDSecurity
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void btnEnter_Click(object sender, EventArgs e)
        {
            this.lblMessage.Text = "";
            UserDataProvider uDataProvider = new UserDataProvider();
            User user = new User();
            user.Login = txtLogin.Text;
            user.Password = txtPassword.Text;

            user.Classe = uDataProvider.GetUserSecurityLevel(user);
            if (user.Classe != -1)
            {
                StartForm start = new StartForm(user);
                start.Visible = true;
            }
            else
            {
                this.lblMessage.Text = "Login ou senha inválido";
                txtPassword.Text = "";                 
            }
            
        }
    }
}
